#!/bin/sh
###Operation servobj&&servgrp for test time


add_service()
{
	#####Servobj operation#####
	./servobj add dns0 17 0-65535 53-53
	./servobj add dns1 6 0-65535 53-53
	./servobj add telnet 6 0-65535 23-23
	./servobj add http 6 0-65535 80-80
	./servobj add ssh 6 0-65535 22-22
	./servobj add ftp 6 0-65535 20-21
	./servobj add https 6 0-65535 80-80

	#All paten
	./servobj add all_tcp 6 0-65535 0-65535
	./servobj add all_udp 17 0-65535 0-65535

}

add_servgrp()
{
	./servgrp -A internet -s dns0
	./servgrp -A internet -s dns1
	./servgrp -A internet -s http

	./servgrp -A internet -s all_tcp
	./servgrp -A internet -s all_udp
}

add_iptables()
{
	iptables -A FORWARD -m state --state ESTABLISHED -j ACCEPT
	iptables -A FORWARD -i eth2 -o eth0 -m servgrp --name internet -j ACCEPT
}

flush_iptables()
{
	iptables -F
	iptables -I INPUT -j ACCEPT
}


add_service
add_servgrp
flush_iptables
add_iptables
